#
# Name:    makefile
# Creates: tinyxpath static lib: libtinyxpath.a
# Usage:   make -f makefile
#

TARGET=libtinyxpath.a

VERSION_INFO=$(shell svnversion)

# Source dir list
source_dirs := ./src 

CC = g++
AR = ar

CFLAGS       = $(EXTRA_CFLAGS) -O2 -ggdb3 -Wall -Wshadow -rdynamic 
DEFLIST      = $(EXTRA_DEFLIST) -DLINUX -DTIXML_USE_STL -D_FILE_OFFSET_BITS=64
IPATHS       = $(EXTRA_IPATHS) -I./include -I/usr/local/include -I../tinyxml/include

libdir = ${TARGET_INSTALL_DIR}/lib
includedir = ${TARGET_INSTALL_DIR}/include
targetlibdir = $(libdir)/$(TARGET_INSTALL_SUBDIR)
targetincdir = $(includedir)/$(TARGET_INSTALL_SUBDIR)

VPATH   := $(source_dirs)

s := $(addsuffix /*.cpp,$(source_dirs))

$(TARGET): $(notdir $(patsubst   %.cpp,%.o,$(wildcard   $(s))))
	@echo Linking $@
	@$(AR) -cr $@ $^
	@echo Done.

%.o: %.cpp
	@echo Compiling $<
	@$(CC) $(CFLAGS) $(DEFLIST) $(IPATHS) $(LFLAGS) -c -MD $(addprefix -I ,$(source_dirs)) $<
include $(wildcard   *.d)

all: $(TARGET)

this: $(TARGET)

clean: 
	rm  -f *.o
	rm  -f *.d
	rm  -f $(TARGET)

version:
	@echo $(VERSION_INFO)

update:
	@svn up $(SVN_PARAMS)

